package com.wn.ticket.web;

import com.wn.ticket.common.ResponseEntity;
import com.wn.ticket.entity.Notice;
import com.wn.ticket.entity.Perform;
import com.wn.ticket.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/front/notice")
public class WebNoticeController {
    @Autowired
    private NoticeService noticeService;
    @RequestMapping("/getall")
    public ResponseEntity getAll() {
        List<Notice> noticeList = noticeService.getAll();
        List<Perform> performList = noticeList.stream().map(n -> n.getPerform()).collect(Collectors.toList());
        return new ResponseEntity(performList);
    }

}
